package oving8;

import java.awt.Graphics2D;
import java.awt.Shape;

public class MoveableObject extends ShapeObject{
	
	int x;
	int y;
	public MoveableObject(Shape shape) {
		super(shape);
		x=0;
		y=0;
	}
	public int getX(){
		return x;
	}
	public int getY(){
		return y;
	}
	public void move(int dx, int dy){
		x+=dx;
		y+=dy;
	}
	public boolean contains(int x,int y){
		return shape.contains(x-this.x, y-this.y);
	}
	public void paint(Graphics2D g){
		g.translate(x, y);
		super.paint(g);
		g.translate(-x, -y);
	}
	
}
